Baseball, by the Rules

Seattle Mariners manager Scott Servais takes the ball from pitcher Yimi García during a game against the Detroit Tigers.
Pitching Change
A pitching change can come at almost any point in a game, even between pitches in a plate appearance. The “almost” here refers to the fact that when a pitcher enters a game, MLB rules state that they must face at least three batters before they are relieved. Similarly, a pitcher who starts an inning must face at least one batter before being relieved, even if they would be eligible for relief under other rules. All of these rules are superseded if a pitcher is injured.
When a team is preparing to make a pitching change, they will start by having the next pitcher warm up in the “bullpen”; in most MLB parks, the bullpens are located behind the outfield fences in various configurations1. Depending on the game state, two relievers may be warming up at the same time2. Once the manager is ready to make the change, they will walk out to the pitching mound to take the ball from the current pitcher. On the way, they will make a gesture with their left or right hand; this indicates the specific pitcher they want to bring in: left hand for a left-hander, right hand for a right-hander. One of the base umpires then relays the message out to the bullpen, and the new pitcher comes in.
Once the new pitcher crosses onto the field, a timer starts. The relief pitcher has 2 minutes (or 2 minutes, 55 seconds during the post-season) to throw as many warmup pitches as they can. The timing rules here are the same as you find for warmups between innings: the home plate umpire will signal the final warmup pitch when the timer hits 25 seconds, and the pitcher will need to throw that pitch before the time gets to 20 seconds remaining. After the next batter is announced, the pitcher must get ready to pitch, and must go into their windup before the timer drops below five seconds. The home plate umpire does have discretion to delay the timer if needed, especially to protect the health of the pitcher.
One reason to delay the timer— often when a relief pitcher comes into a game, they will be subjected to a foreign substance check on their way to the mound. If such a check is made, the timer will often be paused. Assuming the reliever passes the check, the timer resumes as the pitcher makes their way to the mound.
Note that if a reliever is coming in to replaced an injured pitcher, all of the above rules about the timer do not apply. Usually when a pitcher gets hurt, there will have not been anyone already up in the bullpen. As such, the reliever who comes in gets as much time as they need to get ready.